<?php
require_once SMARTY_DIR . 'Smarty.class.php';

$smarty = new Smarty;
$smarty->compile_check = true;
$smarty->debugging = false;

$templateVars = array();

function assignTemplateVars($varName1 /*...*/) 
{
   global $templateVars;
   $args = func_get_args();
   $templateVars = array_merge($templateVars, $args);
}

function display($templateName) 
{
   global $smarty, $templateVars;
   foreach ($templateVars as $varName) {
      $smarty->assign_by_ref( $varName, $GLOBALS[$varName] );
   }
   $smarty->display($templateName . '.tpl');
}
?>